import Vue from 'vue'
import App from './App.vue'
import '@/assets/css/bootstrap.css'

Vue.config.productionTip = false

import Vuex from 'vuex'
Vue.use(Vuex)

const store = new Vuex.Store({
  state: {
    count: 0,
    list: [1, 2, 3, 4, 5, 6, 7, 8]
  },
  mutations: {
    add(state) {
      state.count++
    },
    subminus(state, payload) {
      state.count -= payload
    }
  },
  actions: {
    getasyancCount(context, params) {
      setTimeout(() => {
        context.commit('subminus', params)
      }, 1000)
    }
  },
  getters: {
    //计算属性
    filterList: state => state.list.filter(item => item > 5)
  }
})
new Vue({
  render: h => h(App),
  store
}).$mount('#app')
